package ua.kpi_java_training.tyshchenko.module2;

/**
 * Class from which to extend the types of fish
 *
 * @author Vlad Tyshchenko
 * @version 1.1 3 June 2013
 */
abstract public class CreatureInHabitat {
    private Position position;
    private MovementBehavior fishMove;


    /**
     * The constructor create new object, which consist habitat's data
     *
     * @param habitat
     */

    public CreatureInHabitat(Habitat habitat) {
        position = new Position(habitat);
        fishMove = new MovementInFourDirections(position);
    }


    /**
     * @param lengthStep the amount of steps per cycle
     */

    public void move(int lengthStep) {
        fishMove.move(lengthStep);
    }


    public Position getPosition() {
        return position;
    }

    /**
     * All fish contains a counter that determines the appearance of new fish
     */
    abstract public void addCountNewLife();

    /**
     * Method checks the condition of appearance a new fish.
     *
     * @return true - emergence of new fish
     */
    abstract public boolean checkBirth();

    /**
     * Method creates objects of class CreatureInHabitat
     *
     * @return - object CreatureInHabitat
     */
    abstract public CreatureInHabitat getNewFish();

    abstract public void move();

    abstract public KindOfCreatures getKeyCreature();

}
